<?php

header ('Content-type: text/html; charset=UTF-8'); 

//header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() - 3600));

require_once("configuration.php");

error_reporting(E_ALL OR E_NOTICE OR E_STRICT);

	if(empty($_REQUEST['id']))
		$view_id	=	"";
	else
		$view_id	=	$_REQUEST['id'];
	
?>

<script src="system.js"></script>


<script language="javascript" type="text/javascript">

					
function submitbutton(pressbutton) 
{
	//var form = document.adminForm;

	switch( pressbutton )
	{
		
		
		case	"delete":
		{
			
				
				var r = confirm("Tem certeza que deseja excluir?");
				if (r == true)
				{
				
					var oObject = {} ;
					
					oObject["id"] = '<?php echo $view_id;?>';
					oObject["component"] = "etl";
					oObject["controller"] = "view";
					oObject["task"] = "delete";
					
					
					var jsonVales	=	convertToJSON(oObject);
					
					parameters	=	'parameters='+encodeURIComponent(
											convertToStringJSON(jsonVales));
					
					var method='DELETE';
						
						
					httpRequest ( method,
									url_API,
									parameters,
									'retornDelete');
									
				}
				else
				{
					window.location.href='view_list.php';
				}
								
				

				return false;
			
			
		}break;
		default:
		{
			
		}
	}	
	
}

function retornDelete(jsonObj){
	
	if( jsonObj.status == 1){
		
		window.location.href='view_list.php';
			
	}else{
		
		alert( jsonObj.data );
	}
}


</script>

</script>

<div id="text-result-delete" style="visibility:hidden;width:1px;height:1px;"></div>

<script>
submitbutton('delete');
</script>